package com.chaopei.array;

/**
 * @Author Corday 天涯
 * @Date 2022/3/4 16:39
 */
public class MyReference {
    public static void main(String[] args) {
        refOne(19, 20, 10);
        int[] ages = {12, 12, 13, 16, 11};
        refOne(ages);
        System.out.println("\n--------------------");
        int[][] faces={{98,99,88},{91,92,93},{95,97,94}};
        refTwo(faces);
        System.out.println("--------------------");
        int[] a1={1,2,5,3,8,4};
        int[] a2={2,4,5,6,9,12};
        int[] a3={3,21,11,7,8};
        refTwo(a1,a3,a2,a1);
    }//main

    //    1.可变参数,代替方法中的多个参数或数组
    public static void refOne(int... ref) {
        for (int temp : ref) {
            System.out.print(temp + " ");
        }
    }

    //    2.代替二维数组,可以入多个一维数组
    public static void refTwo(int[]... refs) {
        for (int i = 0; i < refs.length; i++) {
            for (int j = 0; j < refs[i].length; j++) {
                System.out.print(refs[i][j] + " ");
            }
//            转行输出
            System.out.println();
        }
    }

}
